from django.shortcuts import render

# Create your views here.
from rest_framework.views import APIView
from .models import *
from django.http import HttpResponse
import json
class Show(APIView):
    def get(self, request):
        goods = Goods.objects.filter().all()
        data = []
        for i in goods:
            data.append({
                'id' : i.id,
                'name' : i.name,
                'price' : int(i.price)
            })
        return HttpResponse(json.dumps({'code' : 200, 'data' : data}))

